"use strict";

// const {
//   ModuleFederationPlugin,
// } = require("@module-federation/enhanced/rspack");
const { container } = require("webpack");
const { merge } = require("webpack-merge");

const common = require("./webpack.config.cjs");

/**
 * @type {import("@rspack/cli").Configuration}
 */
module.exports = merge(
  {
    output: {
      // 需要设置一个唯一值，不能和其他应用相等
      uniqueName: "ngV1_provider",
      // 使用 manifest 必须要配置 publicPath
      publicPath: `http://localhost:${process.env.PORT}/`,
    },
    plugins: [
      new container.ModuleFederationPlugin({
        name: "ngV1_provider",
        exposes: {
          "./rp_app": "./src/index.mjs",
        },
        shared: ["angular", "jquery"],
      }),
    ],
  },
  common,
);
